package com.gxufl.console;

import java.util.List;
import java.util.Scanner;

import com.gxufl.entity.Notice;
import com.gxufl.entity.Room;
import com.gxufl.service.NoticeService;
import com.gxufl.service.RoomService;
import com.gxufl.util.BackException;
import com.gxufl.util.InputUtil;

public class RoomConsole {
	
	RoomService service = new RoomService();

	public void showRoomList() throws BackException {
		
		String name = InputUtil.nextInput("请输入影厅名称");
		
		List<Room> list = service.searchRoom(name);
		// for打印输出
		for (int i = 0, ii = list.size(); i < ii; i++) {
			Room room = list.get(i);
			System.out.println("影厅名称："+room.name+",座位数："+room.num);
		}
	}

	/**
	 * 处理保存海报逻辑
	 * @throws BackException 
	 */
	public void saveRoom() throws BackException {
		String name = InputUtil.nextInput("请输入影厅名称：");
		Integer num = InputUtil.nextIntInput("请输入影厅座位数：");
		Room room = new Room(num, name);
		service.saveRoom(room);
	}
}
